﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpenseSystem.Model;
using ExpenseSystem.Lor;
using ExpenseSystem.Common;
using ExpenseSystem.DataUpdater;
using ExpenseSystem.Fether;
using ExpenseSystem.Core.DataAddOn;


namespace ExpenseSystem.Core.UserModules
{
    public class UserBaseManager:UserManager
    {
        UserFetcher fetcher = new UserFetcher();
        public override bool Delete(UserModel user,  out string message)
        {
            return updater.Remove(user, tran, fetcher, out message);
        }

        public override bool DeleteById(long[] userId,  out string message)
        {
            bool result = true;
            result = updater.RemoveById(userId, tran, fetcher, out message);
            return result;
        }

        public override bool Save(UserModel user,  out string message ,params IAddable<UserModel>[] addables)
        {
            if (addables != null)
            {
                foreach (IAddable<UserModel> addon in addables)
                {
                    addon.Add(user);
                }
            }
            return updater.Save(user, tran, fetcher, out message);
        }
    }
}
